package com.example.mytestdemo

import android.app.Activity
import android.content.Intent
import android.os.*
import android.os.Trace
import android.util.Log
import android.view.MotionEvent
import com.example.mytestdemo.car.CarMainActivity
import com.example.mytestdemo.car.appwidget.SimpleAppWidgetActivity
import com.example.mytestdemo.car.media.CarMediaSessionActivity
import com.example.mytestdemo.car.surfaceview.CarSurFaceViewActivity
import com.example.mytestdemo.custom.DrawSrcDstActivity
import com.example.mytestdemo.customviewbook.Rotate3DActivity
import com.example.mytestdemo.customviewbook.TesttranslateActivity
import com.example.mytestdemo.customviewbook.five.multitouch.harvic.blogmultitouch.FiveMainActivity
import com.example.mytestdemo.customviewbook.four.sliding.harvic.slidingconflict.testtouchevent.FourMainActivity
import com.example.mytestdemo.customviewbook.six.scrollerdemo.SixMainActivity
import com.example.mytestdemo.customviewbook.three.CustomViewThreeActivity
import com.example.mytestdemo.customviewbook.two.PolytoPolyViewActivity
import com.example.mytestdemo.databinding.ActivityMainBinding
import com.example.mytestdemo.launch.TestLaunchActivity
import com.example.mytestdemo.linearlayoutmanager.CustomLinearLayoutMangerActivity
import com.example.mytestdemo.miv.TestMVIActivity
import com.example.mytestdemo.recognition.client.RecognitionActivity
import com.example.mytestdemo.scale.ScaleViewActivity
import com.example.mytestdemo.scan.ScanViewMainActivity
import com.example.mytestdemo.scroll.AppbarUseActivity
import com.example.mytestdemo.softkey.SoftKeyActivity
import com.example.mytestdemo.text.TextScrollActivity
import com.example.mytestdemo.text.TextUseActivity
import com.example.mytestdemo.threejs.ThreeJs3dActivity
import com.example.mytestdemo.view.camera3dapplication.Camera3dActivity
import com.example.mytestdemo.viewpage2.ViewPager2ListAdapterActivity


/*
   组件化开发时  databinding使用报错的话，不仅当前 模块配置
    dataBinding {
        enabled = true
    }
    主项目模块也要配置
* java.lang.ClassNotFoundException: Didn't find class "androidx.databinding.Da
*
*
* */
class MainActivity : BaseViewBindActivity<ActivityMainBinding>() {


    override fun getLayoutInflateId(): Int {
        return R.layout.activity_main
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    override fun initData() {
        val handle = object : Handler(Looper.myLooper()!!) {
            override fun handleMessage(msg: Message) {
                super.handleMessage(msg)

            }
        }
    }
    

    override fun initUI() {
//        ValueAnimatorUtil.resetDurationScaleIfDisable()

        mBind.btSoftkey.setOnClickListener {
            startActivity(Intent(this, SoftKeyActivity::class.java))
        }
        mBind.btViewpager2.setOnClickListener {
            startActivity(Intent(this, ViewPager2ListAdapterActivity::class.java))
        }

        mBind.btLearningLinearlayout.setOnClickListener {
            startActivity(Intent(this, CustomLinearLayoutMangerActivity::class.java))
        }

        mBind.btLearningLaunch.setOnClickListener {
            startActivity(Intent(this, TestLaunchActivity::class.java))
        }

        mBind.btLearningMvi.setOnClickListener {
            startActivity(Intent(this, TestMVIActivity::class.java))
        }

        mBind.btScale.setOnClickListener {
            startActivity(Intent(this, ScaleViewActivity::class.java))
        }
        mBind.btCar.setOnClickListener {
            startActivity(Intent(this, CarMainActivity::class.java))
        }

        mBind.btWidget.setOnClickListener {
            startActivity(Intent(this, SimpleAppWidgetActivity::class.java))
        }

        mBind.btSurface.setOnClickListener {
            startActivity(Intent(this, CarSurFaceViewActivity::class.java))
        }

        mBind.btMedia.setOnClickListener {
            startActivity(Intent(this, CarMediaSessionActivity::class.java))
        }

        mBind.btCamera3d.setOnClickListener {
            startActivity(Intent(this, Rotate3DActivity::class.java))
        }


        mBind.btTranslate.setOnClickListener {
            startActivity(Intent(this, TesttranslateActivity::class.java))
        }

        mBind.btPolyview.setOnClickListener {
            startActivity(Intent(this, PolytoPolyViewActivity::class.java))
        }

        mBind.btThree.setOnClickListener {
            startActivity(Intent(this, CustomViewThreeActivity::class.java))
        }

        mBind.btFoure.setOnClickListener {
            startActivity(Intent(this, FourMainActivity::class.java))
        }

        mBind.btFigure.setOnClickListener {
            startActivity(Intent(this, FiveMainActivity::class.java))
        }

        mBind.btScroll.setOnClickListener {
            startActivity(Intent(this, SixMainActivity::class.java))
        }
        mBind.tvScanView.setOnClickListener {
            startActivity(Intent(this, ScanViewMainActivity::class.java))
        }

        mBind.tvRecordVoice.setOnClickListener {
            startActivity(Intent(this, RecognitionActivity::class.java))
        }

        mBind.tvAppbar.setOnClickListener {
            startActivity(Intent(this, AppbarUseActivity::class.java))
        }

        mBind.tvTextUse.setOnClickListener {
            startActivity(Intent(this, TextUseActivity::class.java))
        }
        mBind.tvTextScroll.setOnClickListener {
            startActivity(Intent(this, TextScrollActivity::class.java))
        }
        mBind.tvDrawSrcDst.setOnClickListener {
            startActivity(Intent(this, DrawSrcDstActivity::class.java))
        }
        mBind.tv3dCamera.setOnClickListener {
            startActivity(Intent(this, Camera3dActivity::class.java))
        }

        mBind.tvThreeJs3d.setOnClickListener {
            startActivity(Intent(this, ThreeJs3dActivity::class.java))
        }



    }


    override fun onTouchEvent(event: MotionEvent?): Boolean {
        Log.d(TAG, "onTouchEvasfasent: ")
        return super.onTouchEvent(event)
    }
}
internal object Trace {
    fun i(tag: String?) {
        Trace.beginSection(tag!!)
    }

    fun o(activity:Activity) {
        Trace.endSection()
    }
}
open class a {
    open val aa: String? = "safsdg"
}

class b : a() {
    override var aa: String? = "b"
    fun bb() {
    }
}